836. 矩形重叠
为保证权益,题目请参考 836. 矩形重叠(From LeetCode).
解决方案1
CPP
C++
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
// chong dir
bool isRectangleOverlap(vector<int> &rec1, vector<int> &rec2)
{
if (min(rec1[2], rec2[2]) > max(rec1[0], rec2[0]))
{
if(min(rec1[3], rec2[3]) > max(rec1[1], rec2[1]))
{
return true;
}
}
return false;
}
};
int main()
{
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26